import Mock from 'mockjs'

Mock.mock('/api/login','post',config=>{
  console.log(config)
  if(config.body.username === 'admin' && config.body.password === '123'){
    return {
      code:0,
      msg:'登录成功',
      data:{
        token:'123',
        roles:['admin']
      }
    }
  }else if(config.body.username === 'user'){
    return {
      code:0,
      msg:'登录成功',
      data:{
        token:'123',
        roles:['user']
      }
    }
  }
  return {
    code:1001,
    msg:'账号或密码错误',
    data:null
  }
})